package com.yikaiye.android.yikaiye.ui.fragment;

import androidx.fragment.app.Fragment;

import com.yikaiye.android.yikaiye.R;
import com.yikaiye.android.yikaiye.base.BaseFragment;
import com.yikaiye.android.yikaiye.base.BaseViewModel;
import com.yikaiye.android.yikaiye.databinding.FragmentOrderBinding;
import com.yikaiye.android.yikaiye.ui.adapter.ViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class ServiceFragment extends BaseFragment<FragmentOrderBinding, BaseViewModel> {

    private final List<String> titles = new ArrayList<>();
    private final List<Fragment> fragments = new ArrayList<>();

    @Override
    protected BaseViewModel bindModel() {
        return getViewModel(this, BaseViewModel.class);
    }

    @Override
    protected void initInject() {
        getFragmentComponent().inject(this);
    }

    @Override
    protected void lazyLoadData() {
        binding.titleTv.setText(mContext.getString(R.string.my_service));
        titles.add(mContext.getString(R.string.all_text));
        titles.add(mContext.getString(R.string.wait_work));
        titles.add(mContext.getString(R.string.working));
        titles.add(mContext.getString(R.string.already_work_finish));
        titles.add(mContext.getString(R.string.pause));
        titles.add(mContext.getString(R.string.already_complete));
        fragments.add(ServiceStatusFragment.newInstance(null));
        fragments.add(ServiceStatusFragment.newInstance(String.valueOf(0)));
        fragments.add(ServiceStatusFragment.newInstance(String.valueOf(1)));
        fragments.add(ServiceStatusFragment.newInstance(String.valueOf(3)));
        fragments.add(ServiceStatusFragment.newInstance(String.valueOf(2)));
        fragments.add(ServiceStatusFragment.newInstance(String.valueOf(4)));
        ViewPagerAdapter adapter = new ViewPagerAdapter(getChildFragmentManager(), 0, titles, fragments);
        binding.viewPager.setAdapter(adapter);
        binding.tabLayout.setViewPager(binding.viewPager);
        binding.viewPager.setOffscreenPageLimit(6);
    }

    @Override
    protected void initData() {

    }
}
